<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>

$(function(){
	
});

function release(){
	var title = $("#title").val();
	var content = $("#content").val();
	var storiedBuliding = $("#storiedBuliding").val();
	var type = $("#type").val();
	if(title != "" && content != ""){
		$.messager.confirm({
			title:'提示',
			msg:'确定发布吗，此栋寝室学生都可收到',
			top:50,
			fn:function(r){
				if(r){
					$.ajax({
						type:'POST',
						url:'addAnnouncements.action',
						data:{title:title,content:content,storiedBuliding:storiedBuliding,type:type},
						datatype:'json',
						success:function(msg){
							if(msg.status == "200"){
								window.location.href="announcementsList.action";  
							}else{
								$.messager.alert("提示","发布失败");
							}
						}
					});
				}
			}
		});
	}
}